<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>改变颜色</button>
    <ul>
        <li>我是孩子</li>
        <li>我是孩子</li>
        <li>我是孩子</li>
        <li>我是孩子</li>
        <li>我是孩子</li>
    </ul>
    <script>
        let btn = document.querySelector('button')
        let ul = document.querySelector('ul')
        // ul.children是ul的所有子节点
        // console.log(ul.children);
        for (let i = 0; i < ul.children.length; i++) {
            btn.addEventListener('click', function () {
                ul.children[i].style.color = 'red'
            })
        }
    </script>
</body>

</html>